# import socketserver
#
#
# class mysocket(socketserver.BaseRequestHandler):
#     def handle(self):
#         while True:
#             conn = self.request
#             msg = conn.recv(1024).decode('utf-8')
#             print('client:', msg)
#             conn.send(msg.upper().encode('utf-8'))
#
#
# socketserver.TCPServer.allow_reuse_address = True
# server = socketserver.ThreadingTCPServer(('192.168.0.1', 8080), mysocket)
# server.serve_forever()

import socketserver


class mysever(socketserver.BaseRequestHandler):
    def handle(self):
        while True:
            conn = self.request
            msg = conn.recv(1024).decode('utf-8')
            conn.send(msg.upper().encode('utf-8'))


socketserver.ThreadingTCPServer.allow_reuse_address = True
sv = socketserver.ThreadingTCPServer(('192.168.0.1', 8976), mysever)
sv.serve_forever()
